from django.shortcuts import render

# Create your views here.
from django_filters.rest_framework import DjangoFilterBackend
from rest_framework.filters import OrderingFilter
from rest_framework.generics import ListAPIView
from rest_framework.viewsets import ModelViewSet

from api.filters import StudentFilter
from api.serializers import StudentSimpleSerilizer, GradeSerilizer, CollegeSerilizer
from managesys.models import Student, Grade, College


class StudentSimpleView(ModelViewSet):
    queryset = Student.objects.all()
    serializer_class = StudentSimpleSerilizer
    filter_backends = (DjangoFilterBackend,OrderingFilter)
    filterset_class = StudentFilter

class GradeView(ModelViewSet):
    queryset = Grade.objects.all()
    serializer_class = GradeSerilizer
    pagination_class = None

class CollegeView(ListAPIView):
    queryset = College.objects.all()
    serializer_class = CollegeSerilizer
    pagination_class = None